{{/*
Extract the port number from the listen address.
*/}}
{{- define "extractPort" -}}
{{- $listenAddress := .Values.web.listenAddress -}}
{{- if hasPrefix ":" $listenAddress -}}
{{- $port := (regexFind ":(\\d+)" $listenAddress) -}}
{{- if $port -}}
{{- $port | trimPrefix ":" -}}
{{- end -}}
{{- else -}}
{{- $port := $listenAddress -}}
{{- if $port -}}
{{- $port -}}
{{- end -}}
{{- end -}}
{{- end -}}

